package com.ocom.nettyxf.vo;

import com.ocom.common.utils.NumConvertUtil;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: TODO
 * @Author: 朱晖
 * @Date: 2022/10/24
 **/
@Data
public class WhiteListVo {
	//响应结果
	String code = "0000" ;

	//黑/白名单标志
	String blackAndWhite  =  "00";
	//全量/增量标志
	String model  =  "00";

	//黑/白名单组号
	String groupNo = "00000000";
	//下发的白名单数量
	String blackSum = "00";

	//白名单的字节数
	String blackCount = "0A";


	List<WhiteUserVo> list =new ArrayList<>();


	public String getHexStr() throws Exception {
		blackSum = NumConvertUtil.IntToHexStringNum(list.size(), 2);
		String result = code
				+blackAndWhite
				+model
				+groupNo
				+blackSum
				+blackCount
				 ;
		for (WhiteUserVo whiteUserVo : list){
			result += whiteUserVo.getPId();
			result += whiteUserVo.getCardNo();
			result += whiteUserVo.getCardType();
			result += whiteUserVo.getState();
		}

		return  result;
	}

}
